<template>
  <div class="base-table-box">
    <div class="table-select-group">
      <div class="left">
        <s-select
          :selectOption="proposal.proposalSessionId"
          v-model="params.strYear"
        />
        <s-select
          :selectOption="proposal.reporterType"
          v-model="params.strPubState"
          placeholder="-提案者类型-"
        />
        <s-select
          :selectOption="proposal.meeting"
          v-model="params.strPubState"
          placeholder="-会中提案-"
        />
        <s-select
          :selectOption="proposal.searchType"
          v-model="params.searchType"
        />
        <a-input
          class="search-input"
          v-model="params.search"
          placeholder="请输入搜索内容"
        />
        <a-button style="margin-left: 16px" type="primary" @click="start"
          >查询</a-button
        >
        <a-button @click="reset" class="btn-reset">重置</a-button>
      </div>

      <div class="right">
        <a-button type="primary" @click="add">导出提案</a-button>
        <a-button type="danger" @click="deleteList(selectedRowKeys)"
          >导出目录</a-button
        >
      </div>
    </div>

    <a-table
      :row-selection="{
        selectedRowKeys: selectedRowKeys,
        onChange: onSelectChange
      }"
      :pagination="pagination"
      :columns="columns"
      :data-source="tableData"
      :loading="loading"
      :scroll="{ y: '100%' }"
    >
      <span slot="action" slot-scope="text, record">
        <router-link :to="'./receiveList/receive?id=' + record.key"
          >接收</router-link
        >
        <router-link :to="'./receiveList/proof?id=' + record.key"
          >校对</router-link
        >
      </span>
    </a-table>
  </div>
</template>
<script>
import paging from 'mixins/paging'
import deleteItem from 'mixins/delete-table-item.js'
import { proposal } from 'assets/js/select-option-list'
const columns = [
  {
    title: '通知标题',
    dataIndex: 'name'
  },
  {
    title: '发布单位',
    dataIndex: 'age'
  },
  {
    title: '发布时间',
    dataIndex: 'address',
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '发布状态',
    dataIndex: 'address2',
    sorter: (a, b) => a.name.length - b.name.length
  },
  {
    title: '操作',
    dataIndex: 'address3',
    scopedSlots: { customRender: 'action' }
  }
]

export default {
  data() {
    return {
      columns,
      proposal,
      params: {
        strYear: '0',
        strPubState: undefined,
        search: undefined,
        searchType: undefined
      },
      year: [
        { key: '2021', label: '2021' },
        { key: '2020', label: '2020' }
      ]
    }
  },
  mixins: [paging, deleteItem],
  components: {},
  methods: {
    start() {
      console.log(this.form)
      // this.loading = true
      // // ajax request after empty completing
      // setTimeout(() => {
      //   this.loading = false
      //   this.selectedRowKeys = []
      // }, 1000)
    },
    reset() {
      this.form = {}
    },
    add() {
      this.$router.push('./addnotice')
    },
    deleteList(ids) {
      this.deleteItemMixins(() => {}, ids)
    },
    getTableData() {
      for (let i = 0; i < this.pagination.pageSize; i++) {
        this.tableData.push({
          key: i,
          name: `Edward King ${i}`,
          age: 32,
          address: `London, Park Lane no. ${i}`
        })
      }
      this.pagination.total = 200
    }
  }
}
</script>
<style lang="less" scoped>
.ant-select {
  min-width: 150px;
}
</style>